package com.yuven.baselib.utils;

import android.app.Application;
import android.content.pm.ApplicationInfo;

import com.hjq.toast.ToastUtils;

/**
 * 初始化入口
 */
public class ToolsKit {

    private static Application mOuterApp;
    private static boolean isOuterDebug;

    /**
     * 起始初始化
     *
     * @param application
     */
    public static void init(Application application) {
        mOuterApp = application;
        ActivityManager.getInstance().init(application);
        ToastUtils.init(application);

        ApplicationInfo info = mOuterApp.getApplicationInfo();
        setIsDebug((info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
    }

    /**
     * 设置是不是Debug模式
     *
     * @param debug
     */
    public static void setIsDebug(boolean debug) {
        isOuterDebug = debug;
    }

    /**
     * 获取debug标识
     *
     * @return
     */
    public static boolean isDebugMode() {
        return isOuterDebug;
    }

    /**
     * 获取outer的application context
     *
     * @return
     */
    public static Application getClient() {
        return mOuterApp;
    }
}
